/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * <p>Project: app2022 - Exception2
 * <p>Powered by webrx On 2022-01-14 11:02:25
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Exception2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            System.out.println("请输入数字a");
            int a = sc.nextInt();
            System.out.println("请输入数字b");
            int b = sc.nextInt();
            if (a % b == 0) {
                System.out.printf("%d / %d = %d%n", a, b, a / b);
            } else {
                System.out.printf("%d / %d = %d ...... %d%n", a, b, a / b, a % b);
            }
        } catch (InputMismatchException e) {
            System.out.println("输入错误，请输入整数？");
        } catch (ArithmeticException e) {
            System.out.println("第二个整数输入错误，不能输入0?");
        } catch (Exception e) {
            System.out.println("程序未知异常...");
        }
    }
}
